package com.qst.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.qst.dao.ApplyMapper;
import com.qst.dao.HouselistMapper;
import com.qst.pojo.Apply;
import com.qst.pojo.Houselist;
import com.qst.service.ApplyService;

@Service @Transactional public class ApplyServiceImpl implements ApplyService {

	 @Autowired private ApplyMapper applyMapper;
	 @Autowired private HouselistMapper houselistMapper;

	 @Override public void insertapply(Apply apply) {
		  applyMapper.insertapply(apply);

	 }

	 @Override public List<Apply> findApplyList(Integer fangdongid) throws Exception {
		  List<Apply> apply = applyMapper.findApplyList(fangdongid);
		  return apply;
	 }

	 @Override public Apply findbyhouse_id(String house_id) {
		  Apply apply = applyMapper.findbyhouse_id(house_id);
		  return apply;
	 }

	 @Override public void deletebyhouse_id(String house_id) {
		  applyMapper.deletebyhouse_id(house_id);

	 }

	 @Override public void refuseapply(Houselist houselist) {
		  houselistMapper.updatestatus(houselist);
		  applyMapper.deletebyhouse_id(houselist.getHouseid());
	 }

	 @Override public List<Apply> findAllApplyList() {
		  List<Apply> apply = applyMapper.findAllApplyList();
		  return apply;
	 }

}
